home *** CD-ROM | disk | FTP | other *** search
- Path: news.ahc.ameritech.com!datalytics!usenet
- From: Rob Stewart <stew@datalytics.com>
- Newsgroups: comp.lang.c++
- Subject: Re: Exception Overhead
- Date: Wed, 20 Mar 1996 12:27:29 -0500
- Organization: Datalytics, Inc
- Message-ID: <31504001.27D7@datalytics.com>
- References: <4ipc4c$nl5@news.nstn.ca>
- NNTP-Posting-Host: 204.62.224.71
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (WinNT; I)
-
- hfreeman wrote:
- >
- > When my apps throw exceptions, it is in truly exceptional situations,
- > thus, I'm not overly concerned about performance when exceptions are
- > thrown, but could someone please speak to the performance hits taken when
- > exceptions are used but not thrown (ie. when try blocks are entered and
- > exited). If a try block is used in a loop, is there a serious performance
- > penalty.
- >
- > Thanks.
-
- The performance hit is implementation-dependent. The compiler
- has to track which objects to destruct when an exception is
- thrown at any point within a function, so just enabling
- exception support invokes this overhead. A try block shouldn't
- incur much overhead, but I don't think it can incur zero
- overhead. As a result, you should always minimize your
- try/catch blocks--keeping them out of loops, for example.
-
- --
- Robert Stewart | My opinions are usually my own.
- Datalytics, Inc. | stew@datalytics.com
-